import { Module } from '@nestjs/common';
import { DbService } from './db.service';
import { TypeOrmModule } from '@nestjs/typeorm'

import { Connection } from 'typeorm';


@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'localhost',
      port: 3306,
      username: 'user',
      password: 'user888',
      database: 'workflow',
      //entities: [], // 引入实体类
      synchronize: false, // 自动同步,生产环境关闭
      autoLoadEntities: true
    }),
  ],
  providers: [DbService],
  exports: [DbService],
})
export class DbModule {
  constructor(private readonly connection: Connection) { }
}
